// Copyright 2006 PR1ME. All Rights Reserved.

public class Rank implements Comparable {

  public Rank(int localFreq, int globalFreq, String word) {
    this.localFreq = localFreq;
    this.globalFreq = globalFreq;
    this.word = word;
  }

  public int compareTo(Object o) {
    Rank other = (Rank) o;
    if (other.localFreq == localFreq) {
      return globalFreq - other.globalFreq;
    }
    return other.localFreq - localFreq;
  }

  public String getWord() {
    return word;
  }

  public String toString() {
    return word + "(" + localFreq + "," + globalFreq + ")";
  }

  private final int globalFreq;
  private final int localFreq;
  private final String word;

}
